package com.offer;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: huangzhigao
 * @Date: 2023/3/4 17:58
 */
public class offer50 {
    public char firstUniqChar(String s) {
        Map<Character,Integer> map = new HashMap<>();
        char[] chars = s.toCharArray();
        for(char c:chars){
            map.put(c,map.getOrDefault(c,0)+1);
        }
        for(char c:chars){
            if(map.get(c) == 1){
                return c;
            }
        }


        return ' ';
    }
}
